SET XACT_ABORT OFF SET ARITHABORT OFF /* DECLARE GLOBAL VARIABLES */ DECLARE @rptPK int DECLARE @rptGroupPK int DECLARE @errorcount int /* ============================================================ ReportID: KPITrendComparison Report Name: KPI Trend Comparison ============================================================ */ if exists ( select ReportName from Reports WITH (NOLOCK) where ReportID = 'KPITrendComparison') BEGIN PRINT '*******************************************************' PRINT 'Report Exists - Updating...' PRINT 'Report: KPI Trend Comparison' PRINT '*******************************************************' /* ================================================ UPDATE REPORT RECORDS - (KPITrendComparison) ================================================ */ /* Set ReportPK for this Report */ SELECT @rptPK = ReportPK FROM Reports WITH (NOLOCK) WHERE ReportID='KPITrendComparison' /* Update Main Report Fields */ UPDATE Reports SET [ReportIDPriorToCopy]='ExecutiveMetrics', [ReportDesc]=null, [Sort1]=null, [Sort2]=null, [Sort3]=null, [Sort4]=null, [Sort5]=null, [Sort1DESC]=0, [Sort2DESC]=0, [Sort3DESC]=0, [Sort4DESC]=0, [Sort5DESC]=0, [Group1]=0, [Group2]=0, [Group3]=0, [Group4]=0, [Group5]=0, [Header1]=0, [Header2]=0, [Header3]=0, [Header4]=0, [Header5]=0, [GroupHeader1]=null, [GroupHeader2]=null, [GroupHeader3]=null, [GroupHeader4]=null, [GroupHeader5]=null, [Total1]=0, [Total2]=0, [Total3]=0, [Total4]=0, [Total5]=0, [Chart]=null, [ChartName]=null, [ChartField]='SORT1', [ChartSize]=null, [ReportFile]='rpt_KPITrendComparison.asp', [FromSQL]='FROM KPIGroup', [JoinSQL]='INNER JOIN KPIGroupKPI ON KPIGroup.KPIGroupPK = KPIGroupKPI.KPIGroupPK INNER JOIN KPI ON KPI.KPIPK = KPIGroupKPI.KPIPK', [WhereSQL]=null, [GroupBy]=0, [hits]=405, [Sequence]=0, [Layout]='hor', [VertCols]=1, [PageBreakEachRecord]=0, [Custom]=0, [ReportCopy]=0, [MCRegistrationDB]=0, [PrintCriteria]=1, [Active]=1, [UDFChar1]=null, [UDFChar2]=null, [UDFChar3]=null, [UDFChar4]=null, [UDFChar5]=null, [UDFDate1]=null, [UDFDate2]=null, [DemoLaborPK]=null, [RowVersionIPAddress]='', [RowVersionUserPK]='', [RowVersionInitials]='_MC', [RowVersionAction]='EDIT', [RowVersionDate]=getdate() , [ChartFunction]=null, [ChartFunctionField]=null, [NoDetail]=0, [PB1]=0, [PB2]=0, [PB3]=0, [PB4]=0, [PB5]=0, [SLDefault]=0, [SLType]=' ', [SLAction]='PW', [SLModuleID]=' ', [SLPKField]=null, [SLReportID]=null, [SLCustomAction]=null, [SLTooltip]=null, [SDDisplay]=' ', [SDModuleID]=' ', [SDPKField]=null, [SmartEmail]=0, [ChartPosition]=null, [ChartFormat]=null, [ChartSQL]=null, [Chart2]=null, [ChartName2]=null, [ChartField2]=null, [ChartSize2]=null, [ChartFormat2]=null, [ChartFunction2]=null, [ChartFunctionField2]=null, [ChartPosition2]=null, [ChartSQL2]=null, [Chart3]=null, [ChartName3]=null, [ChartField3]=null, [ChartSize3]=null, [ChartFormat3]=null, [ChartFunction3]=null, [ChartFunctionField3]=null, [ChartPosition3]=null, [ChartSQL3]=null, [ChartOnly]=0, [NoHeader]=0, [SRID1]=null, [SRPKField1]=null, [SRID2]=null, [SRPKField2]=null, [SRID3]=null, [SRPKField3]=null, [SRID4]=null, [SRPKField4]=null, [SRID5]=null, [SRPKField5]=null, [ReportPageSize]='Default', [ReportWidth]='100%', [PhotoCriteria]=1, [ReportStyleName]='Default', [UsedFor]='REPORTS', [SmartEmailLaborPK]=0, [LockReport]=0, [SCDefault]='H', [SCField1]=null, [SCField2]=null, [SCField3]=null, [ReportStyleFontSize]=null, [ReportStyleFontColor]=null, [ReportStyleFontFamily]=null where ReportPK = @rptPK if (@@error > 0) Set @errorcount = @errorcount + 1 PRINT 'Updating Report - KPITrendComparison' /* ================================================== DELETE AND INSERT REPORT GROUPS - (KPITrendComparison) =================================================== */ DELETE FROM Report_ReportGroup WHERE ReportPK = @rptPK PRINT 'Deleting Report_ReportGroup Rows - KPITrendComparison' if (@@error > 0) Set @errorcount = @errorcount + 1 /* Make sure the report group actually exists */ if not exists (select ReportGroupPK FROM ReportGroup where ReportGroupPK = 54) BEGIN INSERT INTO ReportGroup ([ReportGroupID], [ReportGroupName], [ModuleID], [Sequence], [Icon], [RepairCenterPK], [IsUserGroup], [IsBatchGroup], [UDFChar1], [UDFChar2], [UDFChar3], [UDFChar4], [UDFChar5], [UDFDate1], [UDFDate2], [DemoLaborPK], [RowVersionIPAddress], [RowVersionUserPK], [RowVersionInitials], [RowVersionAction], [RowVersionDate]) VALUES ('SY', 'System', 'SY', 99, null, null, 0, 0, null, null, null, null, null, null, null, null, '', '', '_MC', 'CREATE', getdate()) PRINT 'Inserting ReportGroup Row - ' + 'System' if (@@error > 0) Set @errorcount = @errorcount + 1 Set @rptGroupPK = @@Identity END else BEGIN UPDATE ReportGroup SET [ReportGroupID]='SY', [ReportGroupName]='System', [ModuleID]='SY', [Sequence]=99, [Icon]=null, [RepairCenterPK]=null, [IsUserGroup]=0, [IsBatchGroup]=0, [UDFChar1]=null, [UDFChar2]=null, [UDFChar3]=null, [UDFChar4]=null, [UDFChar5]=null, [UDFDate1]=null, [UDFDate2]=null, [DemoLaborPK]=null, [RowVersionIPAddress]='', [RowVersionUserPK]='', [RowVersionInitials]='_MC', [RowVersionAction]='EDIT', [RowVersionDate]=getdate() WHERE ReportGroupPK = 54 PRINT 'Updating ReportGroup Row - ' + 'System' Set @rptGroupPK = 54 END if (@@error > 0) Set @errorcount = @errorcount + 1 INSERT INTO Report_ReportGroup ([ReportPK], [ReportGroupPK], [DemoLaborPK], [RowVersionUserPK], [RowVersionInitials], [RowVersionDate]) VALUES (@rptPK, @rptGroupPK, '', '', '_MC', getdate()) PRINT 'Inserting Report_ReportGroup Row - ' + 'System' if (@@error > 0) Set @errorcount = @errorcount + 1 /* ================================================== DELETE AND INSERT REPORT TABLES - (KPITrendComparison) =================================================== */ DELETE FROM ReportTables WHERE ReportPK = @rptPK PRINT 'Deleting ReportTables Rows - KPITrendComparison' if (@@error > 0) Set @errorcount = @errorcount + 1 INSERT INTO ReportTables ([ReportPK], [RFTable], [Alias], [DisplayOrder], [LabelOverride], [DemoLaborPK], [RowVersionIPAddress], [RowVersionUserPK], [RowVersionInitials], [RowVersionDate]) VALUES (@rptPK, 'KPI', null, 0, null, null, '', '', '_MC', getdate()) PRINT 'Inserting ReportTables Row - KPI' if (@@error > 0) Set @errorcount = @errorcount + 1 INSERT INTO ReportTables ([ReportPK], [RFTable], [Alias], [DisplayOrder], [LabelOverride], [DemoLaborPK], [RowVersionIPAddress], [RowVersionUserPK], [RowVersionInitials], [RowVersionDate]) VALUES (@rptPK, 'KPIGroup', null, 0, null, null, '', '', '_MC', getdate()) PRINT 'Inserting ReportTables Row - KPIGroup' if (@@error > 0) Set @errorcount = @errorcount + 1 /* ================================================== UPDATE OR INSERT REPORT CRITERIA - (KPITrendComparison) =================================================== */ if exists ( select ReportCriteriaPK from ReportCriteria WITH (NOLOCK) WHERE ReportPK = @rptPK AND DisplayTable = 'KPIGroup' AND DisplayField = 'Name') BEGIN UPDATE ReportCriteria SET [SQLWhereTable]='KPIGroup', [SQLWhereField]='Name', [CritName]=null, [Operator]='is', [isMulti]=0, [AskLater]=1, [LabelOverride]=null, [DisplayOrder]=0, [FK_LookupOverride]=null, [DemoLaborPK]=null, [RowVersionIPAddress]='', [RowVersionUserPK]='', [RowVersionInitials]='_MC', [RowVersionDate]=getdate() WHERE ReportPK = @rptPK AND DisplayTable = 'KPIGroup' AND DisplayField = 'Name' if (@@error > 0) Set @errorcount = @errorcount + 1 PRINT 'Updating ReportCriteria Row - KPIGroup.Name' END else BEGIN INSERT INTO ReportCriteria ([ReportPK], [DisplayTable], [DisplayField], [SQLWhereTable], [SQLWhereField], [DefaultCritValue], [CritName], [Operator], [isMulti], [AskLater], [LabelOverride], [DisplayOrder], [FK_LookupOverride], [DemoLaborPK], [RowVersionIPAddress], [RowVersionUserPK], [RowVersionInitials], [RowVersionDate]) VALUES (@rptPK, 'KPIGroup', 'Name', 'KPIGroup', 'Name', 'Executive Data', null, 'is', 0, 1, null, 0, null, null, null, null, '_MC', getdate()) PRINT 'Inserting ReportCriteria Row - KPIGroup.Name' if (@@error > 0) Set @errorcount = @errorcount + 1 END if exists ( select ReportCriteriaPK from ReportCriteria WITH (NOLOCK) WHERE ReportPK = @rptPK AND DisplayTable = 'KPIHistory' AND DisplayField = 'DateStamp') BEGIN UPDATE ReportCriteria SET [SQLWhereTable]='KPIHistory', [SQLWhereField]='DateStamp', [CritName]=null, [Operator]='is within', [isMulti]=0, [AskLater]=1, [LabelOverride]=null, [DisplayOrder]=1, [FK_LookupOverride]=null, [DemoLaborPK]=null, [RowVersionIPAddress]='', [RowVersionUserPK]='', [RowVersionInitials]='_MC', [RowVersionDate]=getdate() WHERE ReportPK = @rptPK AND DisplayTable = 'KPIHistory' AND DisplayField = 'DateStamp' if (@@error > 0) Set @errorcount = @errorcount + 1 PRINT 'Updating ReportCriteria Row - KPIHistory.DateStamp' END else BEGIN INSERT INTO ReportCriteria ([ReportPK], [DisplayTable], [DisplayField], [SQLWhereTable], [SQLWhereField], [DefaultCritValue], [CritName], [Operator], [isMulti], [AskLater], [LabelOverride], [DisplayOrder], [FK_LookupOverride], [DemoLaborPK], [RowVersionIPAddress], [RowVersionUserPK], [RowVersionInitials], [RowVersionDate]) VALUES (@rptPK, 'KPIHistory', 'DateStamp', 'KPIHistory', 'DateStamp', 'L30D', null, 'is within', 0, 1, null, 1, null, null, null, null, '_MC', getdate()) PRINT 'Inserting ReportCriteria Row - KPIHistory.DateStamp' if (@@error > 0) Set @errorcount = @errorcount + 1 END if exists ( select ReportCriteriaPK from ReportCriteria WITH (NOLOCK) WHERE ReportPK = @rptPK AND DisplayTable = 'KPIGroup' AND DisplayField = 'UDFDate1') BEGIN UPDATE ReportCriteria SET [SQLWhereTable]='KPIGroup', [SQLWhereField]='UDFDate1', [CritName]=null, [Operator]='is within', [isMulti]=0, [AskLater]=1, [LabelOverride]=null, [DisplayOrder]=2, [FK_LookupOverride]=null, [DemoLaborPK]=null, [RowVersionIPAddress]='', [RowVersionUserPK]='', [RowVersionInitials]='_MC', [RowVersionDate]=getdate() WHERE ReportPK = @rptPK AND DisplayTable = 'KPIGroup' AND DisplayField = 'UDFDate1' if (@@error > 0) Set @errorcount = @errorcount + 1 PRINT 'Updating ReportCriteria Row - KPIGroup.UDFDate1' END else BEGIN INSERT INTO ReportCriteria ([ReportPK], [DisplayTable], [DisplayField], [SQLWhereTable], [SQLWhereField], [DefaultCritValue], [CritName], [Operator], [isMulti], [AskLater], [LabelOverride], [DisplayOrder], [FK_LookupOverride], [DemoLaborPK], [RowVersionIPAddress], [RowVersionUserPK], [RowVersionInitials], [RowVersionDate]) VALUES (@rptPK, 'KPIGroup', 'UDFDate1', 'KPIGroup', 'UDFDate1', 'LN1M', null, 'is within', 0, 1, null, 2, null, null, null, null, '_MC', getdate()) PRINT 'Inserting ReportCriteria Row - KPIGroup.UDFDate1' if (@@error > 0) Set @errorcount = @errorcount + 1 END /* ================================================== UPDATE OR INSERT REPORT FIELDS - (KPITrendComparison) =================================================== */ if exists ( select ReportFieldPK from ReportFields WITH (NOLOCK) WHERE ReportPK = @rptPK AND RFTable = 'KPIGroup' AND RFField = 'Name') BEGIN UPDATE ReportFields SET [ReportPK]=@rptPK, [DataDictPK]=6954, [AGFunction]=null, [Alias]=null, [DisplayOrder]=0, [Display]=1, [NotUserSelectable]=0, [LabelOverride]=null, [TotalIfSelected]=0, [BlankLineIfSelected]=0, [UseCustomExpression]=0, [CustomExpression]=null, [DemoLaborPK]=null, [RowVersionIPAddress]='', [RowVersionUserPK]='', [RowVersionInitials]='_MC', [RowVersionDate]=getdate(), [SLAction]=null, [SLModuleID]=null, [SLPKField]=null, [SLReportID]=null, [SLCustomAction]=null, [SLToolTip]=null WHERE [ReportPK]=@rptPK AND [RFTable]='KPIGroup' AND [RFField]='Name' if (@@error > 0) Set @errorcount = @errorcount + 1 PRINT 'Updating ReportFields Row - KPIGroup.Name' END else BEGIN INSERT INTO ReportFields([ReportPK], [DataDictPK], [AGFunction], [RFTable], [RFField], [Alias], [DisplayOrder], [Display], [NotUserSelectable], [LabelOverride], [TotalIfSelected], [BlankLineIfSelected], [UseCustomExpression], [CustomExpression], [DemoLaborPK], [RowVersionIPAddress], [RowVersionUserPK], [RowVersionInitials], [RowVersionDate], [SLAction], [SLModuleID], [SLPKField], [SLReportID], [SLCustomAction], [SLTooltip]) VALUES(@rptPK, 6954, null, 'KPIGroup', 'Name', null, 0, 1, 0, null, 0, 0, 0, null, null, '', '', '_MC', getdate(), null, null, null, null, null, null) PRINT 'Inserting ReportFields Row - KPIGroup.Name' if (@@error > 0) Set @errorcount = @errorcount + 1 END if exists ( select ReportFieldPK from ReportFields WITH (NOLOCK) WHERE ReportPK = @rptPK AND RFTable = 'KPI' AND RFField = 'Description') BEGIN UPDATE ReportFields SET [ReportPK]=@rptPK, [DataDictPK]=8424, [AGFunction]=null, [Alias]=null, [DisplayOrder]=1, [Display]=1, [NotUserSelectable]=0, [LabelOverride]=null, [TotalIfSelected]=0, [BlankLineIfSelected]=0, [UseCustomExpression]=0, [CustomExpression]=null, [DemoLaborPK]=null, [RowVersionIPAddress]='', [RowVersionUserPK]='', [RowVersionInitials]='_MC', [RowVersionDate]=getdate(), [SLAction]=null, [SLModuleID]=null, [SLPKField]=null, [SLReportID]=null, [SLCustomAction]=null, [SLToolTip]=null WHERE [ReportPK]=@rptPK AND [RFTable]='KPI' AND [RFField]='Description' if (@@error > 0) Set @errorcount = @errorcount + 1 PRINT 'Updating ReportFields Row - KPI.Description' END else BEGIN INSERT INTO ReportFields([ReportPK], [DataDictPK], [AGFunction], [RFTable], [RFField], [Alias], [DisplayOrder], [Display], [NotUserSelectable], [LabelOverride], [TotalIfSelected], [BlankLineIfSelected], [UseCustomExpression], [CustomExpression], [DemoLaborPK], [RowVersionIPAddress], [RowVersionUserPK], [RowVersionInitials], [RowVersionDate], [SLAction], [SLModuleID], [SLPKField], [SLReportID], [SLCustomAction], [SLTooltip]) VALUES(@rptPK, 8424, null, 'KPI', 'Description', null, 1, 1, 0, null, 0, 0, 0, null, null, '', '', '_MC', getdate(), null, null, null, null, null, null) PRINT 'Inserting ReportFields Row - KPI.Description' if (@@error > 0) Set @errorcount = @errorcount + 1 END /* ===================================================== UPDATE REPORTS COLS IN DATA DICT - (KPITrendComparison) ===================================================== */ END /* REPORT DID NOT EXIST, CREATE ALL RECORDS */ ELSE BEGIN PRINT '*******************************************************' PRINT 'Report Does Not Exist - Inserting...' PRINT 'Report: KPI Trend Comparison' PRINT '*******************************************************' /* ===================================================== INSERT REPORT RECORDS - (KPITrendComparison) ===================================================== */ /* INSERT Main Report */ INSERT INTO Reports([ReportIDPriorToCopy], [ReportID], [ReportName], [ReportDesc], [RepairCenterPK], [Sort1], [Sort2], [Sort3], [Sort4], [Sort5], [Sort1DESC], [Sort2DESC], [Sort3DESC], [Sort4DESC], [Sort5DESC], [Group1], [Group2], [Group3], [Group4], [Group5], [Header1], [Header2], [Header3], [Header4], [Header5], [GroupHeader1], [GroupHeader2], [GroupHeader3], [GroupHeader4], [GroupHeader5], [Total1], [Total2], [Total3], [Total4], [Total5], [Chart], [ChartName], [ChartField], [ChartSize], [ReportFile], [FromSQL], [JoinSQL], [WhereSQL], [GroupBy], [hits], [Sequence], [Layout], [VertCols], [PageBreakEachRecord], [Custom], [ReportCopy], [MCRegistrationDB], [PrintCriteria], [Active], [UDFChar1], [UDFChar2], [UDFChar3], [UDFChar4], [UDFChar5], [UDFDate1], [UDFDate2], [DemoLaborPK], [RowVersionIPAddress], [RowVersionUserPK], [RowVersionInitials], [RowVersionAction], [RowVersionDate], [ChartFunction], [ChartFunctionField], [NoDetail], [PB1], [PB2], [PB3], [PB4], [PB5], [SLDefault], [SLType], [SLAction], [SLModuleID], [SLPKField], [SLReportID], [SLCustomAction], [SLTooltip], [SDDisplay], [SDModuleID], [SDPKField], [SmartEmail], [ChartPosition], [ChartFormat], [ChartSQL], [Chart2], [ChartName2], [ChartField2], [ChartSize2], [ChartFormat2], [ChartFunction2], [ChartFunctionField2], [ChartPosition2], [ChartSQL2], [Chart3], [ChartName3], [ChartField3], [ChartSize3], [ChartFormat3], [ChartFunction3], [ChartFunctionField3], [ChartPosition3], [ChartSQL3], [ChartOnly], [NoHeader], [HavingSQL], [SRID1], [SRPKField1], [SRID2], [SRPKField2], [SRID3], [SRPKField3], [SRID4], [SRPKField4], [SRID5], [SRPKField5], [ReportPageSize], [ReportWidth], [PhotoCriteria], [ReportStyleName], [UsedFor], [SmartEmailLaborPK], [LockReport], [SCDefault], [SCField1], [SCField2], [SCField3], [ReportStyleFontSize], [ReportStyleFontColor], [ReportStyleFontFamily] ) VALUES('ExecutiveMetrics', 'KPITrendComparison', 'KPI Trend Comparison', null, null, null, null, null, null, null, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, null, null, null, null, null, 0, 0, 0, 0, 0, null, null, 'SORT1', null, 'rpt_KPITrendComparison.asp', 'FROM KPIGroup', 'INNER JOIN KPIGroupKPI ON KPIGroup.KPIGroupPK = KPIGroupKPI.KPIGroupPK INNER JOIN KPI ON KPI.KPIPK = KPIGroupKPI.KPIPK', null, 0, 0, 0, 'hor', 1, 0, 0, 0, 0, 1, 1, null, null, null, null, null, null, null, null, '', '', '_MC', 'CREATE', getdate(), null, null, 0, 0, 0, 0, 0, 0, 0, ' ', 'PW', ' ', null, null, null, null, ' ', ' ', null, 0, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 0, 0, null, null, null, null, null, null, null, null, null, null, null, 'Default', '100%', 1, 'Default', 'REPORTS', 0, 0, 'H', null, null, null, null, null, null) PRINT 'Inserting Report - KPITrendComparison' if (@@error > 0) Set @errorcount = @errorcount + 1 Set @rptPK = @@Identity /* ================================================== UPDATE OR INSERT REPORT GROUPS - (KPITrendComparison) =================================================== */ /* Make sure the report group actually exists */ if not exists (select ReportGroupPK FROM ReportGroup where ReportGroupPK = 54) BEGIN INSERT INTO ReportGroup ([ReportGroupID], [ReportGroupName], [ModuleID], [Sequence], [Icon], [RepairCenterPK], [IsUserGroup], [IsBatchGroup], [UDFChar1], [UDFChar2], [UDFChar3], [UDFChar4], [UDFChar5], [UDFDate1], [UDFDate2], [DemoLaborPK], [RowVersionIPAddress], [RowVersionUserPK], [RowVersionInitials], [RowVersionAction], [RowVersionDate]) VALUES ('SY', 'System', 'SY', 99, null, null, 0, 0, null, null, null, null, null, null, null, null, '', '', '_MC', 'CREATE', getdate()) if (@@error > 0) Set @errorcount = @errorcount + 1 PRINT 'Inserting ReportGroup Row - ' + 'System' Set @rptGroupPK = @@Identity END else BEGIN UPDATE ReportGroup SET [ReportGroupID]='SY', [ReportGroupName]='System', [ModuleID]='SY', [Sequence]=99, [Icon]=null, [RepairCenterPK]=null, [IsUserGroup]=0, [IsBatchGroup]=0, [UDFChar1]=null, [UDFChar2]=null, [UDFChar3]=null, [UDFChar4]=null, [UDFChar5]=null, [UDFDate1]=null, [UDFDate2]=null, [DemoLaborPK]=null, [RowVersionIPAddress]='', [RowVersionUserPK]='', [RowVersionInitials]='_MC', [RowVersionAction]='EDIT', [RowVersionDate]=getdate() WHERE ReportGroupPK = 54 if (@@error > 0) Set @errorcount = @errorcount + 1 PRINT 'Updating ReportGroup Row - ' + 'System' Set @rptGroupPK = 54 END INSERT INTO Report_ReportGroup ([ReportPK], [ReportGroupPK], [DemoLaborPK], [RowVersionIPAddress], [RowVersionUserPK], [RowVersionInitials], [RowVersionDate]) VALUES (@rptPK, @rptGroupPK, null, '', '', '_MC', getdate()) PRINT 'Inserting Report_ReportGroup Row - ' + 'System' if (@@error > 0) Set @errorcount = @errorcount + 1 /* ================================================== INSERT REPORT TABLES- (KPITrendComparison) =================================================== */ INSERT INTO ReportTables ([ReportPK], [RFTable], [Alias], [DisplayOrder], [LabelOverride], [DemoLaborPK], [RowVersionIPAddress], [RowVersionUserPK], [RowVersionInitials], [RowVersionDate]) VALUES (@rptPK, 'KPI', null, 0, null, null, '', '', '_MC', getdate()) PRINT 'Inserting ReportTables Row - KPI' if (@@error > 0) Set @errorcount = @errorcount + 1 INSERT INTO ReportTables ([ReportPK], [RFTable], [Alias], [DisplayOrder], [LabelOverride], [DemoLaborPK], [RowVersionIPAddress], [RowVersionUserPK], [RowVersionInitials], [RowVersionDate]) VALUES (@rptPK, 'KPIGroup', null, 0, null, null, '', '', '_MC', getdate()) PRINT 'Inserting ReportTables Row - KPIGroup' if (@@error > 0) Set @errorcount = @errorcount + 1 /* ================================================== INSERT REPORT CRITERIA - (KPITrendComparison) =================================================== */ INSERT INTO ReportCriteria ([ReportPK], [DisplayTable], [DisplayField], [SQLWhereTable], [SQLWhereField], [DefaultCritValue], [CritName], [Operator], [isMulti], [AskLater], [LabelOverride], [DisplayOrder], [FK_LookupOverride], [DemoLaborPK], [RowVersionIPAddress], [RowVersionUserPK], [RowVersionInitials], [RowVersionDate]) VALUES (@rptPK, 'KPIGroup', 'Name', 'KPIGroup', 'Name', 'Executive Data', null, 'is', 0, 1, null, 0, null, null, '', '', '_MC', getdate()) PRINT 'Inserting ReportCriteria Row - KPIGroup.Name' if (@@error > 0) Set @errorcount = @errorcount + 1 INSERT INTO ReportCriteria ([ReportPK], [DisplayTable], [DisplayField], [SQLWhereTable], [SQLWhereField], [DefaultCritValue], [CritName], [Operator], [isMulti], [AskLater], [LabelOverride], [DisplayOrder], [FK_LookupOverride], [DemoLaborPK], [RowVersionIPAddress], [RowVersionUserPK], [RowVersionInitials], [RowVersionDate]) VALUES (@rptPK, 'KPIHistory', 'DateStamp', 'KPIHistory', 'DateStamp', 'L30D', null, 'is within', 0, 1, null, 1, null, null, '', '', '_MC', getdate()) PRINT 'Inserting ReportCriteria Row - KPIHistory.DateStamp' if (@@error > 0) Set @errorcount = @errorcount + 1 INSERT INTO ReportCriteria ([ReportPK], [DisplayTable], [DisplayField], [SQLWhereTable], [SQLWhereField], [DefaultCritValue], [CritName], [Operator], [isMulti], [AskLater], [LabelOverride], [DisplayOrder], [FK_LookupOverride], [DemoLaborPK], [RowVersionIPAddress], [RowVersionUserPK], [RowVersionInitials], [RowVersionDate]) VALUES (@rptPK, 'KPIGroup', 'UDFDate1', 'KPIGroup', 'UDFDate1', 'LN1M', null, 'is within', 0, 1, null, 2, null, null, '', '', '_MC', getdate()) PRINT 'Inserting ReportCriteria Row - KPIGroup.UDFDate1' if (@@error > 0) Set @errorcount = @errorcount + 1 /* ================================================== INSERT REPORT FIELDS - (KPITrendComparison) =================================================== */ INSERT INTO ReportFields([ReportPK], [DataDictPK], [AGFunction], [RFTable], [RFField], [Alias], [DisplayOrder], [Display], [NotUserSelectable], [LabelOverride], [TotalIfSelected], [BlankLineIfSelected], [UseCustomExpression], [CustomExpression], [DemoLaborPK], [RowVersionIPAddress], [RowVersionUserPK], [RowVersionInitials], [RowVersionDate], [SLAction], [SLModuleID], [SLPKField], [SLReportID], [SLCustomAction], [SLTooltip]) VALUES(@rptPK, 6954, null, 'KPIGroup', 'Name', null, 0, 1, 0, null, 0, 0, 0, null, null, '', '', '_MC', getdate(), null, null, null, null, null, null) PRINT 'Inserting ReportFields Row - KPIGroup.Name' if (@@error > 0) Set @errorcount = @errorcount + 1 INSERT INTO ReportFields([ReportPK], [DataDictPK], [AGFunction], [RFTable], [RFField], [Alias], [DisplayOrder], [Display], [NotUserSelectable], [LabelOverride], [TotalIfSelected], [BlankLineIfSelected], [UseCustomExpression], [CustomExpression], [DemoLaborPK], [RowVersionIPAddress], [RowVersionUserPK], [RowVersionInitials], [RowVersionDate], [SLAction], [SLModuleID], [SLPKField], [SLReportID], [SLCustomAction], [SLTooltip]) VALUES(@rptPK, 8424, null, 'KPI', 'Description', null, 1, 1, 0, null, 0, 0, 0, null, null, '', '', '_MC', getdate(), null, null, null, null, null, null) PRINT 'Inserting ReportFields Row - KPI.Description' if (@@error > 0) Set @errorcount = @errorcount + 1 /* ===================================================== UPDATE REPORTS COLS IN DATA DICT - (KPITrendComparison) ===================================================== */ END PRINT '*******************************************************' if (@errorcount > 0) PRINT @errorcount + ' Error(s) Occurred: KPITrendComparison' else PRINT 'No Errors Occurred: KPITrendComparison' GO